/*
 * @Descripttion: 
 * @version: 
 * @Author: 高月飞
 * @Date: 2023-11-17 21:34:02
 * @LastEditors: 高月飞
 * @LastEditTime: 2023-11-25 08:35:48
 */

//网络请求

import { userCustomerattaMessageApi } from "@/services/customer";
import type { ICustomerData } from "@/types/customer";
import { defineStore } from "pinia";
const useAttaStore = defineStore('atta', {
    //持久化操作
    //对于登录信息进行一次持久化操作
    persist: {
        storage: window.sessionStorage,
        paths: ['sttainfo']
    },

    state: () => ({
        attainfo: {
            uploader: "",
            accessoryname: "",
            filesize: "",
            uploadtime: "",
            operator: "",
            illustrate: "",
            operate: "",
        }
    }) as ICustomerData.IRootstore4,

    actions: {
        SETATTAINFO(data: ICustomerData.IRootInterface4) {
            this.attainfo = data
            console.log(this.attainfo)
        },
        async USEPATTACTION(id: number) {
            let ret = await userCustomerattaMessageApi(id)
            if (ret.code === 200) {
                this.SETATTAINFO(ret.data)
            }
            return ret.data
        }

    },


})
export default useAttaStore
